<template>
	<view  class="customerCard" @tap=goItem>
    <view class="avatar"
          :style="{backgroundImage: 'url(' +
           (item.headimgurl)
            + ')'}">
    </view>
    <view class="customer-info">
      <view class="left" style="font-size: 16px;">
        <view class="name">
          {{item.user_name}}
        </view>
        <view style="customer-type;font-size: 14px;margin-top: 3px;">
          {{intent_type }}
        </view>
      </view>
      
      <view class="right" style="color: #969799;margin-top: 3px;text-align: right;font-size:12px" v-if="type">
        <view class="order-status" style="text-align: right;">
          {{ouder}}
        </view>
        <view class="follow_day" style="text-align: right;margin-top: 5px;" v-if="item.follow_day&&item.follow_status!=1">
          {{'已跟进'+item.follow_day+'天'}}
        </view>
      </view>
    </view>
 
	</view>
</template>

<script>
	import {uniNavigate} from "../util/misc"

  export default {
    filters: {
      calculateOrderStatus(val){
        switch (val) {
          case 0:
            return '已成交';
            break;
          case 1:
            return '未完成';
            break;
          default:
            return '沟通中'
        }
      }
    },
		data() {
			return {
			
			};
		},
    methods:{
      goItem(){
        if(this.time){
          uni.navigateTo({
            url: `/pages/note_time/note_time?id=${this.item.id}`,
          });
        }else{
          uni.navigateTo({
            url: `/pages/customerPage?id=${this.item.id}&status=${this.type}`,
          });
        }
      }
    },
    computed:{
      intent_type(){
        if(this.item.intent_client==1){
          return '意向客户'
        }else if(this.item.intent_client==2){
          return '普通客户'
        } else{
					return '合作客户'
				}
      },
      ouder(){
          if(this.item.follow_status==0){
            return '跟进中'
          }else if(this.item.follow_status==1){
            return '已成交'
          }else{
          return '暂无状态'
        }
      }
    },
    props:{
		  item: {
		    type: Object,
        default() {
          return {
            intent_client: '0', // 1意向客户2普通客户
            order:{
              status_text: '0' // 带看情况1未完成0已成交
            },
            
          }
        }
      },
      type:{
		    
      },
      time:false
    },
    mounted(){
      // console.log('客户: ',this.item)
    }
	}
</script>

<style lang="scss" scoped>
  @import "../assets/styles/global";
  
  .customerCard{
    position: relative;
    left: 50%;
    transform: translate(-50%,0);
    width: 343px;
    height: 63px;
    padding: 10px;
    display: flex;
    background: white;
    margin-bottom: 12px;
    display: flex;
    border-radius: 1vw;
    .avatar{
      width: 40px;
      height: 40px;
      border-radius: 50%;
      margin-right: 23px;
      background-color: grey;
      @include borderBox;
      @include cover-no-repeat-center;
    }
    
    .customer-info{
      width: 260px;
      display: flex;
      justify-content: space-between;
      .left{
        max-width: 130px;
        /*background-color: yellow;*/
        .name{
          max-width: 125px;
          height: 20px;
          letter-spacing: 0px;
          color: #232323;
          @include myEllipsis
  
        }
      }
      .right{
        max-width: 120px;
        /*background-color: orange;*/
        .order-status{
          
          /*justify-content: flex-end;*/
        }
      }
    }
  }
 
</style>
